<%@ page language="java" contentType="text/html; charset=UTF-8"   pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="UTF-8">
	<title>用户中心</title>
	<script type="text/javascript" src="/static/js/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
</head>
<body>

<script type="text/javascript">
 	var baseUrl = "http://127.0.0.1:8080/phoenix-apps-cms";
 
 	var hostName = window.location.hostname;
 	
 	function getOneHotGoods(id){
 		$.ajax({
 			url:baseUrl+"/cmsHotGoods/getOneHotGoods/"+id,
 			type:'GET',
 			success:function(v){
 				$("#show").text("IdxHotGoodsRecommended [id=" + v.id + ", goodsId=" + v.goodsId
 							+ ", goodsName=" + v.goodsName + ", goodsPic=" + v.goodsPic
 							+ ", weight=" + v.weight + ", status=" + v.status + ", onlineTime="
 							+ v.onlineTime + ", offlineTime=" + v.offlineTime + ", createTime="
 							+ v.createTime + ", updateTime=" + v.updateTime + "]");
 			}
 		})
 	}
 	
	function showHotGoodsPersist(){
 		$.ajax({
 			url:baseUrl+"/cmsHotGoods/getAllHotGoodsByOrder",
 			type:'POST',
 			data:{pageSize:25,pageNo:1},
 			success:function(res){
 				$("#show").text("");
 				$.each(res.items,function(i,v){
 					$("#show").append("IdxHotGoodsRecommended [id=" + v.id + ", goodsId=" + v.goodsId
 							+ ", goodsName=" + v.goodsName + ", goodsPic=" + v.goodsPic
 							+ ", weight=" + v.weight + ", status=" + v.status + ", onlineTime="
 							+ v.onlineTime + ", offlineTime=" + v.offlineTime + ", createTime="
 							+ v.createTime + ", updateTime=" + v.updateTime + "]<br/>")
 				}) 
 			}
 		})
 	}
	function insertHotGoodsPersist(){
		$.ajax({
 			url:baseUrl+"/cmsHotGoods/addOneHotGoods",
 			type:'POST',
 			data:{status:1,offlineTime:new Date(111111111),onlineTime:new Date(111111111)},
 			success:function(res){
 				$("#show").text("success");
 			},error:function(e1,e2){
 				$("#show").text(e2);
 				$("#show").append(e1.responseText);
 			}
 		})
 	}
	function updateHotGoodsPersist(hotGoodsId){
		$.ajax({
 			url:baseUrl+"/cmsHotGoods/updateOneHotGoods",
 			type:'POST',
 			data:{id:3, goodsId:1, goodsName:'UPDATE 手工干花项链坠子复古毛衣复古项链包包手工干花项链坠子复古毛衣复古项链包包', goodsPic:'/static/demoimg/pic1.jpg', weight:1, status:0, onlineTime:new Date(1430303531), offlineTime:new Date(1430303531), createTime:new Date(1430130318), updateTime:new Date(1430303531)},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	function updateHotGoodsStatusPersist(hotGoodsId,status){
		$.ajax({
 			url:baseUrl+"/cmsHotGoods/updatePicHotGoodsStatus",
 			type:'POST',
 			data:{rgoodsId:hotGoodsId,status:status},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	function updateHotGoodsListStatusPersist(hotGoodsIds,status){
		$.ajax({
 			url:baseUrl+"/cmsHotGoods/updatePicHotGoodsStatusList",
 			type:'POST',
 			data:{list:hotGoodsIds,status:status},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	
	/* setInterval(function(){
		//alert("xx")
		$("#intv").attr("href","http://127.0.0.1:8080/phoenix-apps-cms/cmsHotGoods/index?"+(new Date()).getTime());
	}, 10000); */
 </script>
  <a id='intv' href="http://127.0.0.1:8080/phoenix-apps-cms/cmsHotGoods/index">aaaa</a>
 <br>
<button onclick="getOneHotGoods(1)">show1测试</button><br>
<button onclick="showHotGoodsPersist()">show测试</button><br>
<button onclick="insertHotGoodsPersist()">insert测试</button><br>
<button onclick="updateHotGoodsPersist(2)">updateHotGoods测试</button><br>
<button onclick="updateHotGoodsStatusPersist(2,3)">updateStatus测试</button><br>
<button onclick="updateHotGoodsListStatusPersist('2,3',1)">updateListStatus测试</button><br>
查询结果:<div id="show"></div>

</body>
</html>